package nc.jv.Sort;

/**
 * @author Vadim Gidulyan
 *
 */
public class CountingSorter implements Sorter
{

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public void sort(Comparable[] array)
	{
		if (array == null)
			throw new NullPointerException();
		if (!(array instanceof Number[]))
			throw new IllegalArgumentException();
		if (array.length-1 <= 0)
			return;
		
		Comparable min = array[0],
				   max = array[0];
		for (int i = 1; i < array.length; i++)
		{
			if (array[i].compareTo(min) < 0)
				min = array[i];
			if (array[i].compareTo(max) > 0)
				max = array[i];
		}
		
	}

}
